import request from '@/utils/request'

// 获取我的群组
export function getMyGroup(data) {
  return request({
    url: '/api/web/getMyGroups',
    method: 'post',
    data
  })
}

// 获取群方案列表
export function getGFiles(data) {
  return request({
    url: '/api/web/getGFiles',
    method: 'post',
    data
  })
}

// 保存群文件
export function saveGroupFile(gid, file, onlineUrl, pageCount) {
  return request({
    url: '/api/web/addGroupFile',
    method: 'post',
    data: {
      gid: gid,
      file: file,
      online_url: onlineUrl,
      page_count: pageCount
    }
  })
}

// 方案批量添加到群组
export function addReportToGroup(data){
    return request({
        url:'/api/group/addGroupsFiles',
        method:"post",
        data
    })
}

//获取推荐共享群列表
export function getRcmdGroups(data){
    return request({
        url:'/api/group/getRcmdGroups',
        method:'post',
        data
    })
}

//加入公会
export function joinGroup({sid,gid}){
    return request({
        url:'/api/group/join',
        method:'post',
        data:{
            sid:sid,
            gid:gid
        }
    })
}

//创建群
export function addGroup({sid,name,logo,intro,is_public}){
    const data = {
        sid,
        name,
        logo,
        intro,
        is_public
    }
    return request({
        url:'/api/group/create',
        method:'post',
        data
    })
}

//拉去群头像
export function groupLogo(){
    return request({
        url:'/api/group/getDefaultGlogos',
        method:'get'
    })
}